import React from 'react'
import {Provider} from 'react-redux'
import {PersistGate} from 'redux-persist/es/integration/react'
import './src/config/ReactotronConfig'
import DebugConfig from './src/config/DebugConfig'
import configureStore from './src/store'
import Router from './src/routes';
import AppLoading from "./src/components/base/AppLoading";

const {persistor, store} = configureStore()

const onBeforeLift = () => {
  // take some action before the gate lifts
}

class App extends React.Component {
  render () {
    return (
      <Provider store={store}>
        <PersistGate
          loading={<AppLoading/>}
          onBeforeLift={onBeforeLift}
          persistor={persistor}>
          <Router />
        </PersistGate>
      </Provider>
    )
  }
}

export default DebugConfig.useReactotron ? console.tron.overlay(App) : App


